package com.example.java_blog.config;

import com.example.java_blog.model.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 均先生
 * Date: 2024-03-10
 * Time: 16:20
 */
@ResponseBody
@ControllerAdvice
public class ErrorHandle {
    @ExceptionHandler
    public Result handler(Exception e) {
        return Result.fail(e.getMessage());
    }
}
